//
// Created by liushuai on 2021/2/1.
//

#include "minNumberdisappered.h"
int minNumberdisappered(vector<int>& arr) {
    int num = 0;
    for (auto a : arr) {
        if (a > 0) num ^= a; // 0 ^ 1 ^ 1 ^ 2 ^ 2 = 0, 0 ^ 1 ^ 2 ^ 2 = 1
    }
    for (int i = 1; i <= arr.size(); ++i) {
        num ^= i; // 如果某个数不存在， num将不为0
    }
    return num == 0? arr.size() + 1 : num;
}
